#pragma once
#include "SDLRenderable.h"

namespace ZeEngine
{
    class Font;
    class TransformComponent;
	class IRenderable;
    class TextComponent;

    class SDLRenderer
    {
		friend class GameEngine;

    public:
        SDLRenderer();
        virtual ~SDLRenderer();

		bool Init(const Vector2D<float>& screenResolution);

        SDL_Texture* CreateRenderedText(SDL_Renderer& renderer, Font* pFont, std::string text, SDL_Color textColor, u32 size);
        
        void Render(SDL_Renderer& renderer, const TransformComponent&, IRenderableComponent&, float = 1.0f, const Vector2D<float>& cameraPosition = Vector2D<float>(), u32 viewPortID = 0);
        void RenderImpl(SDL_Renderer& renderer);

		void SortRenderables();
		void ClearRenderables();
		u32 AddViewport(const SDL_Rect& viewport);
		const std::vector<SDLRenderable>& GetRenderables() const { return m_renderables;  }

	private:
		std::vector<SDLRenderable> m_renderables;
		std::vector<SDL_Rect> m_viewports;
    };
}

